
import './assets/main.css'
import naive from 'naive-ui'
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import mitt from 'mitt'
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
import Varlet from '@varlet/ui'
import '@varlet/ui/es/style'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import 'lib-flexible/flexible.js'
import 'lib-flexible-computer';
import Antd from 'ant-design-vue';
import 'ant-design-vue/dist/reset.css';
import '../src/utils/Mock.js'
import VueMarkdownEditor from '@kangc/v-md-editor';
import '@kangc/v-md-editor/lib/style/base-editor.css';
import vuepressTheme from '@kangc/v-md-editor/lib/theme/vuepress.js';
import '@kangc/v-md-editor/lib/theme/style/vuepress.css'
import Prism from 'prismjs'
// 引入节流
import throttleDirective from '@/components/ThrottleDirective'
// 引入防抖
import debounceDirective from '@/components/debounceDirective'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import { DatePicker } from 'ant-design-vue';

import DraggableDirective from './utils/directives/draggable'

import  registerDynamicCopyDirective  from './utils/copyDirective/copy-directive'

VueMarkdownEditor.use(vuepressTheme,{
  Prism,
})

const pinia = createPinia()
const app = createApp(App)
app.directive('draggable', DraggableDirective); // 注册 draggable 指令 
app.directive('copy', registerDynamicCopyDirective); // 注册 copy 指令 
pinia.use(piniaPluginPersistedstate)
app.use(pinia)
app.use(router)
app.use(VueMarkdownEditor);

app.use(Varlet)
app.use(naive)
app.use(ElementPlus)
app.use(Antd)
app.config.globalProperties.$EventBus = mitt() 
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
// 注册节流指令
app.directive('throttle', throttleDirective);  
// 注册防抖指令
app.directive('debounce', debounceDirective); 
app.mount('#app')


export default pinia